from app.models.aigc_order_info import aigc_order_info
from app.models.aigc_report_info import aigc_report_info


class WxAIGCReportInfoViewModel:
    def __init__(self, data):
        self.order_number = data.order_number
        self.title = data.title
        self.chars_sum = data.chars_sum
        self.author = data.author
        self.rate = data.rate
        self.completed = data.completed
        self.create_datetime = data.create_datetime
        self.show_status = '检测中' if data.completed == 0 else '已完成'
        self.create_time = data.create_time
        self.aigc_url = 'https://www.samereport.com/aigc_report/samereport_' + data.order_number + "/" + data.pdfname
        self.report_type = 'aigc'


class WxAIGCReportInfoListView:
    def __init__(self):
        self.code = 0
        self.remain = 0
        self.msg = ''
        self.data = []

    def fill(self, data):
        self.code = 0
        self.msg = ''
        self.count = data.total
        self.data = [WxAIGCReportInfoViewModel(item) for item in data.items]
